Implementing Resonial: Phase Coordination for Multi-Agent AI World Models

Physical Intelligence Research • Garlileo Lab

Gritray Lab · Technical Blog v1.1

Resonial is a latent phase function that coordinates temporal behavior across agents in AI world models. This article provides a minimal implementation example and explains its conceptual motivation.


1. Motivation: Why Temporal Coordination Matters

Most AI world models predict what happens next, but they struggle with when and in what rhythm. Without a global phase signal:

Resonial addresses this by introducing a latent phase function that synchronizes agent behavior across time.


2. Core Concept

2.1 Resonial as a Latent Phase Function

Mathematically, Resonial can be represented as:

$$
\Theta(t) = f(\omega_1 t, \omega_2 t, \dots, \omega_n t; \phi_1, \phi_2, \dots, \phi_n)
$$

Where:

2.2 The Resonial-Fricial-Artifriction Triad

Layer Variable Scope Implementation
Fricial $F(x, t)$ Local contact forces Physics engine (MuJoCo/Isaac Sim)
Artifriction $\tilde{F}(x, t)$ AI-inferred friction Vision encoder + MLP
Resonial $\Theta(t)$ Global phase coordination Latent network (this article)

This triad enables AI to perceive forces, predict interactions, and maintain global temporal order.


3. Minimal Implementation in PyTorch

The following minimal implementation demonstrates a phase coordination layer for multiple agents:

import torch
import torch.nn as nn

class ResonialLayer(nn.Module):
    """
    Minimal Resonial implementation for multi-agent world models.
    """
    def __init__(self, n_agents: int, n_frequencies: int = 4, hidden_dim: int = 64):
        super().__init__()
        self.n_agents = n_agents
        self.n_frequencies = n_frequencies

        # Learnable fundamental frequencies (diurnal, seasonal, etc.)
        self.omega = nn.Parameter(torch.randn(n_frequencies) * 0.1)

        # Learnable phase offsets per agent
        self.phi = nn.Parameter(torch.zeros(n_agents, n_frequencies))

        # Composer: combines base phases with frequencies
        self.composer = nn.Sequential(
            nn.Linear(n_frequencies * 2, hidden_dim),
            nn.SiLU(),
            nn.Linear(hidden_dim, hidden_dim),
            nn.SiLU(),
            nn.Linear(hidden_dim, n_frequencies)
        )

        # Modulator: generates agent-specific phase scalar
        self.modulator = nn.Sequential(
            nn.Linear(n_frequencies + hidden_dim, hidden_dim),
            nn.SiLU(),
            nn.Linear(hidden_dim, 1)
        )

    def forward(self, t: float, agent_id: int = None):
        base_phase = self.omega * t + self.phi
        phase_input = torch.cat([base_phase, self.omega.expand(self.n_agents, -1)], dim=-1)
        composed = self.composer(phase_input)
        mod_input = torch.cat([composed, base_phase], dim=-1)
        theta = self.modulator(mod_input).squeeze(-1)

        if agent_id is not None:
            return theta[agent_id]
        return theta

Notes:


4. Visualization

The diagram below illustrates how the Resonial layer coordinates phase across multiple agents in a world model, while Fricial and Artifriction handle local interactions:

Resonial Phase Coordination Visualization


5. Applications


6. Vision

Resonial complements Fricial (local contact dynamics) and Artifriction (AI-inferred friction) by adding a global temporal dimension. Together:

This triad enables world models to simulate reality in both space and time, bridging micro-scale interactions and macro-scale order.


This report is part of the Gritray Lab series on AI world model architectures. For further reading, see Fricial and Artifriction white papers.